<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateEmailItemsTable extends Migration
{
    /**邮件道具表
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('email_items', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('log_email_id')->comment('邮件ID');
            $table->integer('item_id')->comment('道具id');
            $table->integer('num')->comment('数量');
            $table->tinyInteger('flag')->default(0)->comment('是否绑定');
            $table->timestamps();
            $table->softDeletes();
            $table->index(['log_email_id', 'item_id']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('email_props');
    }
}
